package com.dotflat.photoAlbum.repository;

import com.dotflat.photoAlbum.domain.PhotoAlbum;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;


public interface PhotoAlbumRepository extends JpaRepository<PhotoAlbum, String>, JpaSpecificationExecutor<PhotoAlbum> {

    PhotoAlbum getOneByAreaIdAndChildrenId(String areaId, String childrenId);
    PhotoAlbum getOneByAreaIdAndClassIdIsNullAndTitle(String areaId, String title);

    PhotoAlbum getOneByAreaIdAndIdAndDeletedIsFalse(String areaId, String id);

    List<PhotoAlbum> findAllByDeletedIsFalseAndAreaIdAndIdIn(String areaId, String[] ids);

    Page<PhotoAlbum> findAllByAreaIdAndDeletedIsFalse(String areaId, Pageable pageable);
    List<PhotoAlbum> findAllByAreaIdAndDeletedIsFalseOrderBySortDesc(String areaId);
    List<PhotoAlbum> findAllByAreaIdAndClassIdAndDeletedIsFalseOrderBySortDesc(String areaId, String classId);

}
